home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
demos
/
VGX
/
shadows
/
trackball.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
2KB
|
71 lines
/*
* Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
/*
* trackball.h
* A virtual trackball implementation
* Written by Gavin Bell for Silicon Graphics, November 1988.
*/
/*
* NOTE: If, for some reason, gl.h shouldn't be included, one could
* just define the Matrix type, like so:
* typedef float Matrix[4][4];
*/
#include <gl/gl.h>
#include "vect.h"
/*
* Pass the x and y coordinates of the last and current positions of
* the mouse, scaled so they are from (-1.0 ... 1.0).
*
* if ox,oy is the window's center and sizex,sizey is its size, then
* the proper transformation from screen coordinates (sc) to world
* coordinates (wc) is:
* wcx = (2.0 * (scx-ox)) / (float)sizex - 1.0
* wcy = (2.0 * (scy-oy)) / (float)sizey - 1.0
*
* For a really easy interface to this see 'ui.h'.
*/
void
trackball(float *, float, float, float, float);
/*
* Given two sets of Euler paramaters, add them together to get an
* equivalent third set. When incrementally adding them, the first
* argument here should be the new rotation, the secon and third the
* total rotation (which will be over-written with the resulting new
* total rotation).
*/
void
add_eulers(float *, float *, float *);
/*
* A useful function, builds a rotation matrix in Matrix based on
* given Euler paramaters.
*/
void
build_rotmatrix(Matrix, float *);
/*
* This function computes the Euler paramaters given an xyz axis (the
* first argument, 3 floats) and angle (expressed in radians, the
* second argument). The result is put into the third argument, which
* must be an array of 4 floats.
*/
void
axis_to_euler(float *, float, float *);